package model;

/**
 *
 * @author Malene
 */
public class EventSalg extends EnhedsSalg {

    private int id;
    private final Event event;

    /**
     * Når man henter et eventsalg fra databasen
     * @param id
     * @param salgsPris
     * @param valutaDKK
     * @param rabat
     * @param event
     */
    public EventSalg(int id, int salgsPris, boolean valutaDKK, int rabat, Event event) {
        super(salgsPris, valutaDKK, rabat);
        this.id = id;
        this.event = event;
    }

    /**
     *
     * @param salgsPris Eventets pris i danske kroner
     * @param rabat
     * @param event
     */
    public EventSalg(int salgsPris, int rabat, Event event) {
        super(salgsPris, rabat);
        this.event = event;
    }

    public int getId() {
        return id;
    }

    public Event getEvent() {
        return event;
    }

    @Override
    public void setValutaDKK(boolean valutaDKK) {
        if (valutaDKK) {
            salgsPris = event.getEventType().getPrisDKK();
        } else {
            salgsPris = event.getEventType().getPrisEURO();
        }
        this.valutaDKK = valutaDKK;
    }

    @Override
    public int getTotalPris() {
        return salgsPris;
    }

}
